Component({
  properties: {
    code:{
      type:String,
      value: '44022919910092'
    },
    group: {
      type:Number,
      value:0
    },
    goods: {
      type:Array,
      value:[]
    },
    index: {
      type:Number,
      value:-1
    }
  },
  data: {
    infos: [
      {tip:'待付款',b1:'取消订单',b2:'付款'},
      {tip:'待发货',b1:'取消订单',b2:'再次购买'},
      {tip:'待收货',b1:'取消订单',b2:'确认收货'},
      {tip:'交易完成',b1:'',b2:'评价'},
      {tip:'已取消',b1:'',b2:''}
    ],
    totalPrice:0,
    postage:5.0,
  },
  lifetimes: {
    attached(){
      let totalPrice=0;
      for(let i=0;i<this.properties.goods.length;i++){
        totalPrice+=this.properties.goods[i].price*this.properties.goods[i].numBuys;
      }
      this.setData({totalPrice:totalPrice});
    }
  },
  methods: {
    clickBtn(e) {
      this.triggerEvent('click',{index:this.properties.index,...e.detail});
    }
  }
})
